package com.youmans.demo;

import com.alibaba.excel.EasyExcel;

import java.util.ArrayList;
import java.util.List;

public class TestEasyExcel {
    public static void main(String[] args) {
        read();
    }



    private static void write(){
        String fileName = "D:\\yygh_log\\edu\\write.xls" ;
//        写
        EasyExcel.write(fileName,DemoData.class).sheet("学生列表").doWrite(getData());
    }


    private static void read(){
        String fileName = "D:\\yygh_log\\edu\\write.xls" ;
//        读
        EasyExcel.read(fileName,DemoData.class,new ExcelListener()).sheet().doRead();
    }

    private static List<DemoData> getData(){
        ArrayList<DemoData> list = new ArrayList<>();
        for (int i = 0; i < 10; i++) {
            DemoData data = new DemoData();
            data.setSno(i);
            data.setSname("Bob"+i);
            list.add(data) ;
        }
        return list ;
    }
}
